package com.atguigu.gmall.product.controller;

import com.alibaba.fastjson.JSONObject;
import com.atguigu.gmall.product.service.ManagerService;
import com.atguigu.gmall.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/product")
public class IndexApiController {

    @Autowired
    private ManagerService managerService;

    /**
     * 首页数据查询三级分类数据
     * /api/product/inner/getBaseCategoryList
     * @return
     */
    @GetMapping("/getBaseCategoryList")
    public Result getBaseCategoryList() {
        //JSONObject jsonObject = new JSONObject();
        //jsonObject.put("name","张三");

        List<JSONObject> result = managerService.getBaseCategoryList();
        return Result.ok(result);
    }
}
